package org.wmine.algo;

import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class FreqDistri extends JFrame
{
	public FreqDistri(String[]attribs,int colknt)
	{
		final Container c=this.getContentPane();
		this.setTitle("Frequency Distribution");
		JPanel mainPanel=new JPanel();
		mainPanel.setLayout(null);

		JPanel pan1=new JPanel();
		pan1.setLayout(null);
		pan1.setBounds(10,10,330,330);

		JLabel lab1=new JLabel("Select the Attribute:");

		lab1.setBounds(10,10,160,30);
		final JComboBox com1=new JComboBox();

		int j;
		for(j=0;j<colknt;j++)
		{
		com1.addItem(new String(attribs[j]));
		}
		com1.setEditable(false);
		com1.setBounds(10,45,160,20);

		pan1.add(lab1);
		pan1.add(com1);
		
		JLabel lab2=new JLabel("Number of classes:");
		lab2.setBounds(10,70,230,30);
		final JTextField tf=new JTextField();
		tf.setBounds(10,105,160,20);

		
		pan1.add(lab2);
		pan1.add(tf);
		JButton but1=new JButton("Process");
		JButton but2=new JButton("Cancel");
		but1.setBounds(10,150,90,30);
		but2.setBounds(105,150,80,30);
		pan1.add(but1);
		pan1.add(but2);
		but1.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent ae)
		{
			dispose();
			ProgressBar pb=new ProgressBar();
			pb.getDialog();
		}});
		mainPanel.add(pan1);
		c.add(mainPanel);
		
	}
}